from pydantic import BaseModel, Field
from sqlalchemy import Column, String, BigInteger, Text
from toollib.utils.now2timestamp_ import now2timestamp

from app.datatype import DeclBase, filter_fields
from app.initializer import g


class DefaultPrompt(DeclBase):
    __tablename__ = "default_prompt"

    id = Column(BigInteger, primary_key=True, autoincrement=True, comment="主键")
    session_name = Column(Text, nullable=False, comment="prompt")
    created_at = Column(BigInteger, default=now2timestamp, comment="创建时间")
    updated_at = Column(BigInteger, default=now2timestamp, onupdate=now2timestamp, comment="更新时间")
    #删除状态
    is_deleted = Column(BigInteger, default=0, comment="删除状态，0未删除，1已删除")



class DefaultPromptDetailMdl(BaseModel):
    id: str = Field(...)
    # #
    name: str = None

    @classmethod
    def response_fields(cls):
        return filter_fields(
            cls,
            exclude=[]
        )
